<template>
  <component
    :is="type"
    :placeholder="placeholderStr"
    popupContainer=".page-container"
    :allow-clear="true"
    v-bind="{ ...$attrs, ...$attrs.attrs }"
    v-on="$attrs"
    :style="{ width: '100%' }"
  />
</template>

<script>
  export default {
    name: 'ListSearcherPortal',
    props: {
      type: String,
      placeholder: String,
    },
    computed: {
      placeholderStr() {
        const type = this.type
        if (this.placeholder || this.$attrs?.placeholder) {
          return this.placeholder || this.$attrs?.placeholder
        }
        if (type == 'a-range-picker' || type == 'i-range-picker') {
          return ['开始日期', '结束日期']
        }
        if (type != 'a-input' && type != 'a-input-number') {
          return '请选择'
        }
        return '请输入'
      },
    },
  }
</script>
